package com.goldsign.pay.web.portal.feign.hystrix.sample;

import org.springframework.stereotype.Component;

import com.goldsign.pay.feign.api.sample.facade.SampleFacade;
import com.goldsign.pay.feign.api.sample.fallback.HystrixFallbackFactory;

@Component
public class SampleFeignHystrix extends HystrixFallbackFactory<SampleFacade>{

	@Override
	public SampleFacade create(Throwable cause) {
		System.out.println("fallback reason:" + cause.getMessage());
		
		/**
		 * 回退处理
		 */
		return new SampleFacade(){
        	@Override
    		public String list(String id) {
    			System.out.println("==========call fallback list by Factory=========");
    			return "fallback list:" + id;
    		}

    		@Override
    		public String test(String id) {
    			System.out.println("==========call fallback test by Factory=========");
    			return "fallback test:"  + id;
    		}
        };
	}

}
